package com.zj.thread.executor;

import org.junit.Test;

import java.util.concurrent.*;

public class Test1 {
    static Thread thread = new Thread();
    static Executor executor = (command) -> command.run();//函数式接口
    static ExecutorService executorService = null;//接口
    static ThreadPoolExecutor threadPoolExecutor = null;//ExecutorService实现类之一

    @Test
    public void executorTest() {
        System.out.println("start");
        executor.execute(() -> {
            try {
                TimeUnit.SECONDS.sleep(2);
                System.out.println("i am running");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        System.out.println("start");
    }

    @Test
    public void test2() {
        Thread thread = new Thread(new FutureTask<>(() -> {
            return 1;
        }));
    }

}
